package com.weijun.keepalive_daemon.receiver

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent

/**
 * @author: weijun
 * date: 2023/7/6
 * description:
 */
class ScreenBroadcastReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context?, intent: Intent?) {
        when (intent?.action) {
            Intent.ACTION_SCREEN_ON -> { //开屏
                for (ob in ScreenStatusManager.mObservers) {
                    ob.screenStatusChanged(true)
                }
            }
            Intent.ACTION_SCREEN_OFF -> {//锁屏
                for (ob in ScreenStatusManager.mObservers) {
                    ob.screenStatusChanged(false)
                }
            }
            else -> {}
        }
    }
}